diff options
| author | Adam Soltys <[email protected]> | 2022-09-13 23:18:40 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-13 23:18:40 -0700 |
| commit | 14a9420cc0e8f96e77beeacd02f7dcb44ff76134 (patch) | |
| tree | f17d64d80e62470db4c563d830519fcbbd182482 /src/routes/[username]/dashboard | |
| parent | 328b987ca0b5bc3fadd4c43266775aece93e1df2 (diff) | |
| download | coinos-ui-14a9420cc0e8f96e77beeacd02f7dcb44ff76134.tar.gz coinos-ui-14a9420cc0e8f96e77beeacd02f7dcb44ff76134.zip | |
currency formatting helpers
Diffstat (limited to 'src/routes/[username]/dashboard')
| -rw-r--r-- | src/routes/[username]/dashboard/+page.svelte | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/routes/[username]/dashboard/+page.svelte b/src/routes/[username]/dashboard/+page.svelte index e61360c9..eee13576 100644 --- a/src/routes/[username]/dashboard/+page.svelte +++ b/src/routes/[username]/dashboard/+page.svelte @@ -1,5 +1,5 @@ <script> - import { post, failure } from '$lib/utils'; + import { f, s, post, failure } from '$lib/utils'; import { tick } from 'svelte'; import { AppHeader, Icon } from '$comp'; import { selectedRate } from '$lib/store'; @@ -27,21 +27,13 @@ } }; - $: btcPrice = new Intl.NumberFormat('en-US', { - style: 'currency', - currency: user.currency - }).format($selectedRate); + $: btcPrice = f($selectedRate, user.currency); - $: accountBalanceFiat = new Intl.NumberFormat('en-US', { - style: 'currency', - currency: user.currency - }).format(user.account.balance * ($selectedRate / 100000000)); + $: accountBalanceFiat = f(user.account.balance * ($selectedRate / 100000000), user.currency); $: accountBalanceBtc = user.account.balance / 100000000; - $: accountBalanceSats = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format( - user.account.balance - ); + $: accountBalanceSats = s(user.account.balance); </script> <AppHeader avatarPosition="left-[calc(50vw-48px)] lg:left-[calc(15vw-48px)]" /> |
